<template>
 <div class="seoset">
    <a-form
    :form="form"
    :label-col="{ span: 5 }"
    :wrapper-col="{ span: 12 }"
    @submit="handleSubmit"
  >
    <a-form-item>
      <p>关键词</p>
      <a-input v-decorator="['seoKeyword']" />
    </a-form-item>
    <a-form-item>
      <p>描述信息</p>
      <a-input v-decorator="['seoDesc']" />
    </a-form-item>
    <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
      <a-button type="primary" html-type="submit"> 保存 </a-button>
    </a-form-item>
  </a-form>
 </div>
</template>

<script>
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {
      form: this.$form.createForm(this, { name: "coordinated" }),
    };
  },
  mounted() {
    this.GetSetting();
    this.$nextTick(() => {
      const { setFieldsValue } = this.form;
      setFieldsValue(this.settingList);
    });
  },
  computed: {
    ...mapState({
      settingList: (state) => state.setting.settingList,
    }),
  },
  methods: {
    ...mapActions({
      PostSetting: "setting/PostSetting",
      GetSetting: "setting/GetSetting",
    }),
    handleSubmit(e) {
      e.preventDefault();
      this.form.validateFields((err, values) => {
        console.log("Received values of form: ", values);
        this.PostSetting(values);
      });
    this.GetSetting();
      const { setFieldsValue } = this.form;
      setFieldsValue(this.settingList);
    },
  },
};
</script>

<style></style>
